package com.lovegu.thread;

/**
 * @author 老顾
 * @title: Singleton
 * @projectName java-restudy
 * @email: 1437594522@qq.com
 * @date 2022/9/23 16:08
 */
public class Singleton {
    //饿汉模式
//    private static Singleton instance;
//    private Singleton (){}
//
//    public static Singleton getInstance() {
//        if (instance == null) {
//            instance = new Singleton();
//        }
//        return instance;
//    }
    //懒汉模式
    private static Singleton instance = new Singleton();
    private Singleton (){}
    public static Singleton getInstance() {
        return instance;
    }
}
